package com.tc.service.impl;

import com.tc.R;
import com.tc.entity.Sys_User;
import com.tc.mapper.LoginMapper;
import com.tc.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: wangyifan
 * @Date: 2022/03/02 16:03
 * @Description: $end$
 * @Version: V1.0
 */

@Service
public class LoginServiceImpl implements LoginService {

    @Autowired(required = false)
    private LoginMapper loginMapper;

    @Override
    public R login(String username, String password) {
        R r = new R();
       List<Sys_User>  user = loginMapper.login(username);
       if (user != null){
           r.setMsg("登录成功");
           r.setCode(200);
            r.setData(user);
       }else {
           r.setMsg("登录失败");
           r.setCode(500);
       }
        return r;
    }
}
